/*
 * Copyright 2022 MindMotion Microelectronics Co., Ltd.
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef __BSP_RTC_H__
#define __BSP_RTC_H__

#include "hal_common.h"
#include "hal_rcc.h"
#include "hal_rtc.h"

#include "pin_init.h"
#include "clock_init.h"

#define APP_RTC_CLOCKFREQ     32768u   /* Due to the formula: ftrue_clk = frtc_clk /(prescaler + 1), configure the clock to jump once a second. */
#define APP_RTC_COUNTFREQ     1u       /* Configure the counter frequency, the counter jumps once every second at the fastest.. */
#define APP_RTC_LOWEST_YEARS  1970u    /* Set term of lowest years. */
#define APP_RTC_INIT_YEARS    2008u    /* Configure the clock initial years. */
#define APP_RTC_INIT_MONTHS   12u      /* Configure the clock initial months. */
#define APP_RTC_INIT_DAYS     31u      /* Configure the clock initial days. */
#define APP_RTC_INIT_HOURS    23u      /* Configure the clock initial hours. */
#define APP_RTC_INIT_MINUTES  59u      /* Configure the clock initial minutes. */
#define APP_RTC_INIT_SECONDS  15u      /* Configure the clock initial seconds. */

/* RTC */
#define BOARD_RTC_PORT               RTC
#define BOARD_RTC_IRQn               RTC_IRQn
#define BOARD_RTC_IRQ_HANDLER_FUNC   RTC_IRQHandler


void BSP_RTC_Init(void);
void BSP_RTC_GetTime(void);

#endif /* __BOARD_INIT_H__ */

